﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TheOliver.Controls">

    <!-- PanoramaControl style -->
    <Style
        TargetType="local:PanoramaControl">
        <Setter
            Property="Height"
            Value="800" />
        <Setter
            Property="Width"
            Value="480" />
        <Setter
            Property="DefaultItemWidth"
            Value="433" />
        <Setter
            Property="FontFamily"
            Value="Segoe WP Light" />
        <Setter
            Property="Foreground"
            Value="White" />

        <!-- PanoramaView template -->
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:PanoramaControl">
                    <Canvas
                        Name="LayoutRoot">

                        <StackPanel
                            Name="BackgroundPanelHost"
                            Orientation="Horizontal"
                            CacheMode="BitmapCache">
                            <ContentPresenter
                                Name="BackgroundPanel"
                                Height="{TemplateBinding Height}"
                                Content="{TemplateBinding BackgroundImage}"
                                ContentTemplate="{TemplateBinding BackgroundImageTemplate}"
                                CacheMode="BitmapCache" />
                        </StackPanel>

                        <StackPanel
                            Name="TitlePanelHost"
                            Orientation="Horizontal"
                            Margin="10,0,0,0"
                            CacheMode="BitmapCache">
                            <ContentPresenter
                                Name="TitlePanel"
                                Content="{TemplateBinding Title}"
                                ContentTemplate="{TemplateBinding TitleTemplate}"
                                CacheMode="BitmapCache" />
                        </StackPanel>

                        <StackPanel
                            Name="ItemsPanelHost"
                            Orientation="Horizontal"
                            Margin="22,178,0,0"
                            CacheMode="BitmapCache">
                            <ItemsPresenter
                                Name="ItemsPanel"
                                CacheMode="BitmapCache" />
                        </StackPanel>

                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <!-- BackgroundImage template -->
        <Setter
            Property="BackgroundImageTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel
                        Orientation="Horizontal">
                        <Image
                            Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
                            CacheMode="BitmapCache" />
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <!-- Title template -->
        <Setter
            Property="TitleTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock
                        Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
                        Margin="0,-75,0,0"
                        FontSize="186"
                        Foreground="{TemplateBinding Foreground}"
                        CacheMode="BitmapCache" />
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <!-- ItemsPanel template -->
        <Setter
            Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel
                        Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

    </Style>

    <!-- PanoramaItem styles -->
    <Style
        TargetType="local:PanoramaItem">
        <Setter
            Property="Header"
            Value="header" />
        <Setter
            Property="Width"
            Value="433" />
        <Setter
            Property="MinWidth"
            Value="433" />
        <Setter
            Property="AutoSnap"
            Value="True" />
        <Setter
            Property="FontFamily"
            Value="Segoe WP SemiLight" />
        <Setter
            Property="Foreground"
            Value="White" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:PanoramaItem">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="100" />
                            <RowDefinition
                                Height="25" />
                            <RowDefinition
                                Height="*" />
                        </Grid.RowDefinitions>
                        <ContentControl
                            x:Name="PanoramaItemHeader"
                            Grid.Row="0"
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            FontFamily="{TemplateBinding FontFamily}"
                            FontSize="72"
                            Foreground="{TemplateBinding Foreground}"
                            CacheMode="BitmapCache" />
                        <ContentPresenter
                            x:Name="PanoramaItemContent"
                            Grid.Row="2"
                            Width="{TemplateBinding Width}"
                            CacheMode="BitmapCache" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
